<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;
header('Access-Control-Allow-Origin: *');
header('Access-Control-Max-Age: 1800');
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE');
header('Access-Control-Allow-Headers: Api-Auth, Accept, Auth, Referer, Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With,Content-Length,Spi-Auth');
Route::miss(function (){
    return \think\facade\View::fetch('../view/404.html');
});
Route::rule('','index');
Route::rule('fileimage','api/fileimage');
Route::post('install','install');
Route::post('system','admin');
Route::rule('upload','upload');
Route::rule('user','user');
//-----------------------------------------------
//开始路由
Route::rule('index','index');
Route::rule('about','index');
Route::rule('goods','index');
Route::rule('cart','index');
Route::rule('Single_Sliding_Door','index');
Route::rule('Vanities','index');
Route::rule('Single_Sliding_Door_9757','index');
Route::rule('Bypass_Sliding_Door','index');
Route::rule('Pivot_Door','index');
Route::rule('Inward-Sliding_Door','index');
//结束路由
//-----------------------------------------------
Route::rule('login','login');
Route::rule('product-details','goods');
Route::rule('news-details','info');
Route::group('api',function(){
    Route::rule('login','api.Login/login');
    Route::rule('register','api.Login/register');
    Route::group('order',function (){
        Route::rule('list','list');
        Route::rule('create','create');
    })->prefix('api.Order/');
    Route::group('goods',function(){
        Route::rule('list','list');
        Route::rule('info','info');
        Route::rule('attr','attrdata');
    })->prefix('api.Goods/');
    Route::group('info',function (){
        Route::rule('list','list');
        Route::rule('info','info');
    })->prefix('api.Info/');
})->middleware([\app\middleware\Sign::class]);
Route::group('sys',function(){
    Route::post('login','sys.Login/login');
    Route::rule('image','sys.Login/yanzhengma');//登录验证码
    Route::rule('web','sys.Web/web');
    Route::rule('admin','sys.Admin/info');
    Route::group('info',function (){
//        Route::rule('list','list');
        Route::post('save','save');
    })->prefix('sys.Info/');
    Route::group('images',function (){
        Route::rule('list','list');
        Route::rule('save','save');
        Route::rule('top','top');
        Route::rule('del','delete');
    })->prefix('sys.Image/');
    Route::group('goods',function(){
        Route::rule('info','info');
        Route::rule('save','save');
        Route::rule('status','status');
        Route::rule('delete','delete');
    })->prefix('sys.Goods/');
    Route::group('nav',function(){
        Route::rule('list','list');
        Route::rule('info','info');
        Route::rule('save','save');
        Route::rule('delete','delete');
    })->prefix('sys.Nav/');
    Route::group('nav',function(){
        Route::rule('delete','delete');
    })->prefix('sys.User/');
})->middleware([\app\middleware\Login::class]);
Route::group('home',function(){

});
Route::group('admin',function(){
    Route::rule('web','Admin/web');
    Route::rule('index','Admin/index');
    Route::rule('login','Admin/login');
    Route::rule('admin','Admin/admin');
    Route::rule('image','Admin/image');
    Route::rule('unlogin','Admin/unlogin');
    Route::rule('nav','Admin/nav');
    Route::rule('info','Admin/info');
    Route::rule('goods','Admin/goods');
    Route::rule('user','Admin/user');
});